package com.tjsinfo.tjsoa.mail.action;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;


import com.tjsinfo.tjsoa.common.SessionUser;
import com.tjsinfo.tjsoa.mail.bo.ITjsFoldMailBo;

/**
 * 删除文件夹邮件
 * @author wangxiaowei
 *
 */
public class DeleteFoldEmailAction extends Action{
	private ITjsFoldMailBo foldMailBo; 
	public ITjsFoldMailBo getFoldMailBo() {
		return foldMailBo;
	}
	public void setFoldMailBo(ITjsFoldMailBo foldMailBo) {
		this.foldMailBo = foldMailBo;
	}
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		String id = request.getParameter("id");
		if (foldMailBo.deleteTjsEmailFoldList(request.getParameterValues("checkbox2"),SessionUser.getUser(request).getUsername())) {//删除文件夹邮件
			//RequestDispatcher   ds   =   request.getRequestDispatcher("selectfoldemail.do?id="+id); 
			//ds.forward(request,   response);
			request.setAttribute("linkurl", "tjsinfo/tjsoa/mail/selectfoldemail.do?id="+id);
			request.setAttribute("message", "email.message.deleteemail");
			return mapping.findForward("success");
		} else {
			return mapping.findForward("error");
		}
	}
	
}
